#include "pch.h"
#include "BaseTransform.h"

namespace gaeaway_load
{
    
    namespace datatransform
    {
        //std::string wstringTOstring(std::wstring wstr)
        //{
        //    std::string result;
        //    int len = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), static_cast<int>(wstr.size()), NULL, 0, NULL, NULL);
        //    if (len <= 0)return result;
        //    char* buffer = new char[len + 1];
        //    if (buffer == NULL)return result;
        //    WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), static_cast<int>(wstr.size()), buffer, len, NULL, NULL);
        //    buffer[len] = '\0';
        //    result.append(buffer);
        //    delete[] buffer;
        //    return result;
        //}
        //std::wstring stringTOwstring(std::string str)
        //{
        //    std::wstring result;
        //    int len = MultiByteToWideChar(CP_ACP, 0, str.c_str(), static_cast<int>(str.size()), NULL, 0);
        //    if (len < 0)return result;
        //    wchar_t* buffer = new wchar_t[len + 1];
        //    if (buffer == NULL)return result;
        //    MultiByteToWideChar(CP_ACP, 0, str.c_str(), static_cast<int>(str.size()), buffer, len);
        //    buffer[len] = '\0';
        //    result.append(buffer);
        //    delete[] buffer;
        //    return result;
        //}

        gaeaway_load::EquipmentsOfOutput transformEquipmentList(const LoadedAirplanes& airplanes)
        {
            EquipmentsOfOutput result;
            for (auto air : airplanes)
            {
                for (auto equipment  : air.loadedEquipments)
                {
                    result.emplace_back(EquipmentOfOutput{ air.indexID, equipment.equipmentID, equipment.leftYOfequipment });
                }
            }
            return result;
        }

    }
    
}